package com.dabaozhan.modules.wx_app.service.impl;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.CardMappe;
import com.dabaozhan.modules.wx_app.entity.CardEntity;
import com.dabaozhan.modules.wx_app.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author houzhong
 * @date 2019-01-14 13:52
 */
@Service("cardService")
public class CardServiceImpl implements CardService {

    @Autowired
    private CardMappe cardMappe;

    @Override
    public int saveCard(CardEntity v) {
        if (v.getId() == null) {
            v.setId(Utils.id().toString());
        }
        return cardMappe.save(v);
    }

    @Override
    public int updateCard(CardEntity v) {
        return cardMappe.update(v);
    }

    @Override
    public CardEntity findByCardUserId(String userId) {
        return cardMappe.findByCardUserId(userId);
    }
}
